<?php
define('_file_','add_topic');
if ( !isGod() )
	if ( !getRights($mod,'full') )
		if ( !News_getAccessFile(_file_) )
		{
			showMsg('Không có quyền truy cập vào trang này này !','ex','center');
			die();
		}
	
	if ( @$_POST['cmdOK'] != '' )
	{
		$tname = (!get_magic_quotes_gpc()) ? addslashes(@$_POST['txtTName']) : @$_POST['txtTName'];
		$tdesc = (!get_magic_quotes_gpc()) ? addslashes(@$_POST['txtTDesc']) : @$_POST['txtTDesc'];		
		$tname1 = (!get_magic_quotes_gpc()) ? addslashes(@$_POST['txtTName1']) : @$_POST['txtTName1'];
		$tdesc1 = (!get_magic_quotes_gpc()) ? addslashes(@$_POST['txtTDesc1']) : @$_POST['txtTDesc1'];		
		$num = (!get_magic_quotes_gpc()) ? addslashes(@$_POST['txtNum']) : intval(@$_POST['txtNum']);						

		$sql = "INSERT INTO pctroubleshooting_topic(tname_vn,tname_en,tdesc_vn,tdesc_en,num_article_show) VALUES('$tname','$tname1','$tdesc','$tdesc1',$num)";
		$link->execute($sql);
	
showMsg('Đã thêm mới thành chông<br />Vui lòng chờ trong giây lát...<meta http-equiv="Refresh" content="1;URL=' . $mod . '&act=view_topic" />','ex','center');
		die();
	}
?>
<script language="javascript">
function ValidateForm()
{
	if ( document.all['txtTName'].value == '' )
	{
		alert("Chưa nhap vao ten cua chu de !")
		document.all['txtTName'].focus();
		return false;
	}
	if ( document.all['txtNum'].value == '' )
	{
		alert('Chua nhap vao so tin hien thi !');
		document.all['txtNum'].focus();
		return false;
	}

	return true;
}
</script>
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>

<form action="admin.php?mod=<?= $mod ?>&act=add_topic" method="post" name="frmAddTopic" onSubmit="return ValidateForm()">
<table width="98%"  border="0" cellspacing="1" cellpadding="0" class="clsMyBorder">
  <tr>
    <td colspan="2" height="23" bgcolor="#336699" class="clsTitle">&nbsp;<img src="images/add_trans.gif" border="0" align="absmiddle"> Thêm mới chủ đề</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>  
  <tr>
      <td bgcolor="#F0F0F0">&nbsp;Tên chủ đề (Vietnamese) <span class="style1">(*)</span></td>
    <td bgcolor="#F0F0F0"><input name="txtTName" type="text" size="50" maxlength="50" class="vsinput" value="" ></td>
  </tr>
  <tr>
    <td>&nbsp;Tên chủ đề (English) <span class="style1">(*)</span></td>
    <td><input name="txtTName1" type="text" id="txtTName1" class="vsinput"  size="50" maxlength="50"></td>
  </tr>
  <tr>
    <td bgcolor="#F0F0F0">&nbsp;Mô tả chủ đề (Vietnamese) <span class="style1">(*)</span></td>
    <td bgcolor="#F0F0F0"><input name="txtTDesc" type="text" id="txtTDesc" class="vsinput"  size="50" maxlength="50" /></td>
  </tr>
  <tr>
    <td>&nbsp;Mô tả chủ đề (English) <span class="style1">(*)</span></td>
    <td><input name="txtTDesc1" type="text" id="txtTDesc1" class="vsinput"  size="50" maxlength="50" /></td>
  </tr>
  <tr>
      <td bgcolor="#F0F0F0">&nbsp;Số tin hiển thị<span class="style1"> (*)</span></td>
    <td bgcolor="#F0F0F0"><input name="txtNum" type="text" id="txtNum" class="vsinput"  size="50" maxlength="2" onkeypress="entryNumber()"/></td>
  </tr>  
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" align="right" bgcolor="<?= $clrPanelButton ?>" class="clsPanelButton">
	<input name="cmdOK" type="submit" value="Thêm mới &raquo;">&nbsp;</td>
  </tr>  
</table>

</form>
